/*************************************************************************
> File Name: Vector_test.cpp
> Author: hzy
> Created Time: 2023-08-18 10:09:46
> Description:
************************************************************************/
#include "MyVector.h"
#include "MyVector.hpp"
#include <vector>

void test_01()
{
    MyVector<int> arr1;

    cout << "初始的数组容量和大小为：";
    cout << "capacity = " << arr1.getCapacity();
    cout << ", size = " << arr1.getSize() << endl;

    // 插入数据元素
    arr1.pushBack(55);
    arr1.pushBack(20);
    arr1.pushBack(22);
    arr1.pushBack(22);

    // 成员方法遍历数组元素
    arr1.DisplayArrList();

    // 下标访问数组元素
    cout << arr1[2] << endl;
    // 成员方法访问数组元素
    cout << arr1.at(2) << endl;

    //<<运算符遍历数组
    cout << arr1 << endl;

    cout << "插入元素后的数组容量和大小为：";
    cout << "capacity = " << arr1.getCapacity();
    cout << ", size = " << arr1.getSize() << endl;

    cout << "删除后的元素为：" << endl;
    // 删除数组最后一个元素
    arr1.popBack();

    arr1.DisplayArrList();

    // 清空数组元素
    arr1.Clear();
    // arr1.DisplayArrList();

    cout << "插入元素后的数组容量和大小为：";
    cout << "capacity = " << arr1.getCapacity();
    cout << ", size = " << arr1.getSize() << endl;
}

int main()
{
    test_01();

    return 0;
}